import request from '../request.js'

// 数据项列表名称查询
export function getBaseDictByIdAndName(params) {
  return request({
    url: '/base-dict/getBaseDictByIdAndName',
    method: 'post',
    data: params
  })
}
// 通过id获得当前节点和子节点除字典树
export function getBaseDictById(params) {
  return request({
    url: `/base-dict/getBaseDictById/${params}`,
    method: 'get',
    data: params
  })
}

export function deleteBaseDictVoByIds(params) {
  return request({
    url: '/base-dict/deleteBaseDictVoByIds',
    method: 'post',
    data: params
  })
}
// 批量状态修改
export function updateBaseDictBatch(params) {
  return request({
    url: `/base-dict/updateBaseDictBatch?status=${params.status}`,
    method: 'put',
    data: params.list
  })
}
// 更新字典树
export function updateBaseDictVo(params) {
  return request({
    url: '/base-dict/updateBaseDictVo',
    method: 'post',
    data: params
  })
}
// 添加字典树
export function addBaseDictVo(params) {
  return request({
    url: '/base-dict/addBaseDictVo',
    method: 'post',
    data: params
  })
}
// 字典表列表
export function getAllBaseDict(params) {
  return request({
    url: '/base-dict/getAllBaseDict',
    method: 'post',
    data: params
  })
}

// 修改角色对应的菜单
export function updateRoleMenus(params) {
  return request({
    url: '/sys-menu/updateRoleMenu',
    method: 'post',
    data: params
  })
}
// 查询角色以及他的权限
export function getRoleAndAuthority(params) {
  return request({
    url: `/sys-role/getRoleAndAuthority/?roleId=${params}`,
    method: 'get',
    data: params
  })
}

// 获取权限菜单树形结构
export function getMenuTree(params) {
  return request({
    url: '/sys-menu/getMenuTree',
    method: 'get',
    data: params
  })
}

// 删除角色
export function deleteRole(params) {
  return request({
    url: `sys-role/deleteRole/${params.roleId}`,
    method: 'post',
    data: params
  })
}

// 修改角色
export function updateRole(params) {
  return request({
    url: '/sys-role/updateRole',
    method: 'post',
    data: params
  })
}
// 添加角色
export function insertRole(params) {
  return request({
    url: '/sys-role/insertRole',
    method: 'post',
    data: params
  })
}

//  分页查询角色
export function getAllRoles(params) {
  return request({
    url: 'sys-role/getAllRoles',
    method: 'post',
    data: params
  })
}
